﻿using System;

namespace Quail
{
    /// <summary>
    /// Simple class constructor helper
    /// </summary>
    public static class CreateHelper
    {
        /// <summary>
        /// Creates a new instance of a given class using reflection.
        /// </summary>
        /// <typeparam name="T">The type of object to create.</typeparam>
        /// <param name="parameters">The constructor parameters</param>
        /// <returns>A new instance of T or NULL if something bad happened.</returns>
        public static T CreateInstance<T>(params object[] parameters) where T : class
        {
            return (T)Activator.CreateInstance(
                typeof(T),
                parameters,
                new object[0]);
        }
    }
}
